import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
import comment from "@/store/modules/comment";
import websocket from "@/store/modules/websocket";
import blog from "@/store/modules/blog";

Vue.use(Vuex)

const store = new Vuex.Store({
    modules: {
        user,
        comment,
        websocket,
        blog
    },
    getters: {
        token: state => state.user.token,
        userId: state => state.user.id,
        nickname: state => state.user.nickname,
        name: state => state.user.name,
        userInfo: state => state.user.userInfo,
        comment: state => state.comment.commentList,
        messageValue: state => state.websocket.messageValue,
        article: state => state.blog.articleList,
        searchKey: state => state.blog.searchKey,
        currentPage: state => state.blog.currentPage,
        pageSize: state => state.blog.pageSize,
        total: state => state.blog.total,
        loading: state => state.blog.loading,
    }
})

export default store
